package business.impl;

import java.sql.ResultSet;
import java.util.List;

import model.TPractice;
import model.TStuinfo;
import model.Tteacherinfo;
import model.Vteacherclass;
import business.basic.iHibBaseDAO;
import business.basic.iHibBaseDAOImpl;
import business.dao.TeacherDao;

public class TeacherDaoImpl implements TeacherDao {
	
	iHibBaseDAO bdao = null;
	public void setBdao (iHibBaseDAO bdao){
		this.bdao=bdao;
		
	}

	@Override
	public Tteacherinfo getWorkById(int id) {
		Tteacherinfo title = (Tteacherinfo) bdao.findById(Tteacherinfo.class,id);
		return title;
	}

	@Override
	public int addwork(Tteacherinfo model) {
		Object obj = bdao.insert(model);
		if (obj == null) {
			return 0;
		}
		return 1;
	}

	@Override
	public boolean upWork(Tteacherinfo model) {
		return bdao.update(model);
	}

	@Override
	public boolean delWork(int id) {
		return bdao.delete(Tteacherinfo.class, id);
	}

	@Override
	public Vteacherclass getWorkByuserId(int id) {
		String sql = " from Vteacherclass  where userid= ?  ";
		Object[] para = {id};
		Vteacherclass modl = (Vteacherclass) bdao.selectby(sql, para);
		return modl;
	}

}
